#!/bin/ksh
#
# name: ossec
# purpose: Init script for ossec-hids
# Copyright (C) 2015-2021, Wazuh Inc.
# Aug. 07 2008 Chris Cuevas
#

WAZUH_HOME=WAZUH_HOME_TMP
WAZUH_CONTROL="$WAZUH_HOME/bin/wazuh-control"

case "$1" in
start)
    if [ -f "$WAZUH_CONTROL" ]; then
        echo "Starting Wazuh"
        ${WAZUH_CONTROL} start
    fi
    ;;
stop)
    if [ -f "$WAZUH_CONTROL" ]; then
        echo "Stopping Wazuh"
        ${WAZUH_CONTROL} stop
    fi
    ;;
status)
    if [ -f "$WAZUH_CONTROL" ]; then
        ${WAZUH_CONTROL} status
    fi
    ;;
restart)
    if [ -f "$WAZUH_CONTROL" ]; then
        ${WAZUH_CONTROL} restart
    fi
    ;;
*)
    echo "Usage: $0 (start | stop |restart | status)"
    exit 1
esac
